{% extends "base.html" %}
{# Copyright The IETF Trust 2015, All Rights Reserved #}
{% load origin %}
{% load django_bootstrap5 %}
{% load textfilters %}
{% load person_filters %}
{% block title %}Charter submission for {{ group.acronym }} {{ group.type.name }}{% endblock %}
{% block content %}
    {% origin %}
    <h1>Charter submission</h1>
    <table class="mt-3 table table-sm table-borderless">
        <tbody class="meta border-top">
            <tr>
                <th scope="row">{{ group.type.name }}</th>
                <th scope="row">Name</th>
                <th scope="row" class="fs-6">{{ group.name }}</th>
            </tr>
            <tr>
                <td></td>
                <th scope="row">Acronym</th>
                <td>
                    <a href="{{ group.about_url }}">{{ group.acronym }}</a>
                </td>
            </tr>
            <tr>
                <td></td>
                {% if group.parent and group.parent.type_id == "area" %}
                    <th scope="row">{{ group.parent.type.name }}</th>
                    <td>
                        {{ group.parent.name }} (<a href="{{ group.parent.about_url }}">{{ group.parent.acronym }}</a>)
                    </td>
                {% else %}
                    <td></td>
                    <td></td>
                {% endif %}
            </tr>
            <tr>
                <td></td>
                <th scope="row">State</th>
                <td>
                    {{ group.state.name }}
                    {% if requested_close %}<div class="badge rounded-pill text-bg-info">In the process of being closed</div>{% endif %}
                </td>
            </tr>
        </tbody>
        {% if group.personnel %}
        <tbody class="meta border-top">
            {% for slug, label, roles in group.personnel %}
                <tr>
                    {% if forloop.first %}
                        <th scope="row">Personnel</th>
                    {% else %}
                        <td></td>
                    {% endif %}
                    <th scope="row">{{ label }}</th>
                    <td>
                        {% for r in roles %}
                            {% person_link r.person %}
                            <br>
                        {% endfor %}
                    </td>
                </tr>
            {% endfor %}
        </tbody>
        {% endif %}
        {% if group.list_email %}
            <tbody class="meta border-top">
                <tr>
                    <th scope="row">Mailing list</th>
                    <th scope="row">Address</th>
                    <td>{{ group.list_email|linkify }}</td>
                </tr>
                <tr>
                    <td></td>
                    <th scope="row">To subscribe</th>
                    <td>{{ group.list_subscribe|linkify }}</td>
                </tr>
                <tr>
                    <td></td>
                    <th scope="row">Archive</th>
                    <td>
                        {{ group.list_archive|linkify }}
                    </td>
                </tr>
            </tbody>
        {% endif %}
    </table>
    <p class="alert alert-info my-3">
        The text will be submitted as <b>{{ name }}-{{ next_rev }}</b>.
    </p>
    <form enctype="multipart/form-data" method="post" id="charter-form">
        {% csrf_token %}
        {% bootstrap_form form %}
        <button type="submit" class="btn btn-primary">
            Submit
        </button>
        {% if group.charter %}
            <a class="btn btn-secondary float-end"
               href="{% url "ietf.doc.views_doc.document_main" name=name %}">
                Back
            </a>
        {% else %}
            <a class="btn btn-secondary float-end"
               href="{% url "ietf.group.views.group_about" group_type=group.type_id acronym=group.acronym %}">
                Back
            </a>
        {% endif %}
    </form>
{% endblock %}